<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCommentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comments', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('page_id')->default(0)->comment('所评论文章的编号');
            $table->string('author')->default('')->comment('发表评论的作者');
            $table->string('author_email')->default('')->comment('发表评论者的邮箱地址');
            $table->string('author_url')->default('')->comment('发表评论者的url');
            $table->ipAddress('author_ip')->comment('发表评论者的ip');
            $table->text('content')->comment('发表评论的内容');
            $table->unsignedInteger('approved')->default(0)->comment('评论状态：0=>等待审批,1=>已审批,2=>垃圾评论');
            $table->string('agent')->default('')->comment('评论者信息(包括浏览器,操作系统的类型版本)');
            $table->unsignedInteger('parent')->default(0)->comment('上级评论');
            $table->unsignedInteger('member_id')->default(0)->comment('0=>游客，否则');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('comments');
    }
}
